Managing Users

This section goes into detail on how to manage users, licenses and custom schemas using this module.

Getting User Info

Get-GSUser

This function pulls info for a specific user, including orgUnitPath, aliases, custom schema values, etc.

Examples

Get-GSUser -Filter *
Get-GSUser -User john.smith@domain.com -Projection Full -ViewType Admin_View
Get-GSUser john.smith@domain.com

Syntax

Get-GSUser [-User] <string> [-Projection {Basic | Custom | Full}] [-CustomFieldMask <string>] [-ViewType {Admin_View | Domain_Public}] [-Fields <string[]>] [-AccessToken <string>] [-P12KeyPath <string>] [-AppEmail <string>] [-AdminEmail <string>]  [<CommonParameters>]

Getting User Photos

To get a user's photo, use the Get-GSUserPhoto function:

Get-GSUserPhoto

Examples

Get-GSUserPhoto john.smith@domain.com

Syntax

Get-GSUserPhoto [-User] <string> [-AccessToken <string>] [-P12KeyPath <string>] [-AppEmail <string>] [-AdminEmail <string>]  [<CommonParameters>]

Listing Users

To list all users in the domain or in a specific organizational unit, use the Get-GSUserList function:

Get-GSUserList

Examples

Get-GSUserList
Get-GSUserList -Query "orgUnitPath='/Users/New Hires'"
Get-GSUserList -MaxResults 300 -Query "orgUnitPath='/Users'","[email protected]"

Syntax

Get-GSUserList [[-Query] <String[]>] [[-PageSize] <Int32>] [[-OrderBy] <String>] [[-SortOrder] <String>] [[-AccessToken] <String>] [[-P12KeyPath] <String>] [[-AppEmail] <String>] [[-AdminEmail] <String>] [[-CustomerID] <String>] [[-Domain] <String>] [[-Preference] <String>] [<CommonParameters>]

Creating Users

To create new users, use the New-GSUser function:

New-GSUser

Examples

New-GSUser -PrimaryEmail john.smith@domain.com -GivenName John -FamilyName Smith -Password Password123
New-GSUser -PrimaryEmail john.smith@domain.com -GivenName John -FamilyName Smith -Password Password123 -ChangePasswordAtNextLogin True -OrgUnitPath "/Users/New Hires" -IncludeInGlobalAddressList True

Syntax

New-GSUser [-PrimaryEmail] <String> [-GivenName] <String> [-FamilyName] <String> [-Password] <String> [[-ChangePasswordAtNextLogin] <String>] [[-OrgUnitPath] <String>] [[-Suspended] <String>] [[-IncludeInGlobalAddressList] <String>] [[-IPWhitelisted] <String>] [[-AccessToken] <String>] [[-P12KeyPath] <String>] [[-AppEmail] <String>] [[-AdminEmail] <String>] [<CommonParameters>]

Updating Users

To update existing users, use the Update-GSUser function:

Update-GSUser

Examples

Update-GSUser -User john.smith@domain.com -PrimaryEmail johnathan.smith@domain.com -GivenName Johnathan -Suspended False

Syntax

Update-GSUser [-User] <String> [[-PrimaryEmail] <String>] [[-GivenName] <String>] [[-FamilyName] <String>] [[-Password] <String>] [[-ChangePasswordAtNextLogin] <String>] [[-OrgUnitPath] <String>] [[-Suspended] <String>] [[-IncludeInGlobalAddressList] <String>] [[-IPWhitelisted] <String>] [[-AccessToken] <String>] [[-P12KeyPath] <String>] [[-AppEmail] <String>] [[-AdminEmail] <String>] [<CommonParameters>]

Removing Users

To remove users, use the Remove-GSUser function:

Remove-GSUser

Examples

Remove-GSUser -User john.smith@domain.com -WhatIf
Remove-GSUser -User john.smith@domain.com -Confirm:$false

Syntax

Remove-GSUser [-User] <String> [[-AccessToken] <String>] [[-P12KeyPath] <String>] [[-AppEmail] <String>] [[-AdminEmail] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]

Restoring Users

To undelete users, use the Restore-GSUser function:

Restore-GSUser

Examples

Restore-GSUser -User john.smith@domain.com -OrgUnitPath "/Users" -WhatIf
Restore-GSUser -User john.smith@domain.com -OrgUnitPath "/Users" -Confirm:$false

Syntax

Restore-GSUser [-User] <String> [-OrgUnitPath] <String> [-AccessToken <String>] [-P12KeyPath <String>] [-AppEmail <String>] [-AdminEmail <String>] [-WhatIf] [-Confirm] [<CommonParameters>]

Getting License Info

To get license info, use the Get-GSUserLicense function:

Get-GSUserLicense

Examples

Get-GSUserLicense -User john.smith@domain.com
Get-GSUserLicense -User john.smith@domain.com -License Google-Vault-Former-Employee

Syntax

Get-GSUserLicense [-License <string>] [-ProductID <string[]>] [-PageSize <int>] [-Limit <int>] [<CommonParameters>]

Get-GSUserLicense [[-User] <string[]>] [-License <string>] [<CommonParameters>]

Listing All Licenses

To list all licenses in the domain, use the Get-GSUserLicense function with no additional parameters

Removing Licenses

To remove licenses, use the Remove-GSUserLicense function:

Remove-GSUserLicense

Examples

Remove-GSUserLicense

Syntax

Remove-GSUserLicense [-User] <string[]> [-License] <string> [-WhatIf] [-Confirm] [<CommonParameters>]

Setting Licenses

To set licenses, use the Set-GSUserLicense function:

Set-GSUserLicense

Examples

Set-GSUserLicense -User joe.smith@domain.com -License Google-Vault-Former-Employee

Syntax

Set-GSUserLicense [-User] <string[]> [-License] <string> [<CommonParameters>]

Updating Licenses

To update licenses, use the Update-GSUserLicense function:

Update-GSUserLicense

Examples

Update-GSUserLicense -User joe.smith@domain.com -License Google-Vault-Former-Employee

Syntax

Update-GSUserLicense [[-User] <string[]>] [-License <string>] [<CommonParameters>]

Getting Custom Schema Info

To get info about a specific custom schema, use the Get-GSUserSchema function:

Get-GSUserSchema

Examples

Get-GSUserSchema -SchemaId $schemaId

Syntax

Get-GSUserSchema [[-SchemaId] <string[]>] [<CommonParameters>]

Listing Custom Schemas

To list all custom schemas, use the Get-GSUserSchema function and do not specify a SchemaId:

Examples

Get-GSUserSchema

Creating Custom Schemas

To create custom schemas, use the New-GSUserSchema function:

New-GSUserSchema

Examples

New-GSUserSchema

Syntax

New-GSUserSchema [-SchemaName] <string> [-Fields] <SchemaFieldSpec[]> [<CommonParameters>]

Removing Custom Schemas

To remove custom schemas, use the Remove-GSUserSchema function:

Remove-GSUserSchema

Examples

Remove-GSUserSchema

Syntax

Remove-GSUserSchema [[-SchemaId] <string[]>] [-WhatIf] [-Confirm] [<CommonParameters>]

Updating Custom Schemas

To update custom schemas, use the Update-GSUserSchema function:

Update-GSUserSchema

Examples

Update-GSUserSchema

Syntax

Update-GSUserSchema [-SchemaId] <string> [-SchemaName <string>] [-Fields <SchemaFieldSpec[]>] [<CommonParameters>]

Comments